package blackitheima1.Test;
//调用枚举的方法
public class EnumTest {
    public static void main(String[] args) {
        //获取枚举对象名称
        String name = Senson.SPRING.name();
        System.out.println(name);

        //获取枚举对象索引
        int ordinal = Senson.SPRING.ordinal();
        System.out.println(ordinal);

        //获取两个枚举对象的索引差值
        int i = Senson.SPRING.compareTo(Senson.WATHER);
        System.out.println(i);

        //打印索引对象名称
        String name1 = Senson.SPRING.toString();
        System.out.println(name1);

        //获取指定枚举指定对象的索引值
        Senson spring = Enum.valueOf(Senson.class, "SPRING");
        System.out.println(spring);

        //获取所有枚举项
        Senson[] values = Senson.values();
        for (Senson value : values) {
            System.out.println(value);
        }

    }
}
